<!DOCTYPE html>
<html>
<head>
<title>Les promotions</title>
<meta name="viewport" charset="utf-8" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
<link href="../css/bootstrap.min.css" rel="stylesheet" media="screen">
<!-- My style -->
<link href="../css/bootstrap.css" rel="stylesheet" media="screen">
<link href="../css/ecran-marketing.css" rel="stylesheet">
</head>
<body>

	<div class="container">
	
	
	<?php
	// //NE PAS SUPPRIMER !!!!!!!!!!!!!
	// // AFFICHE LA LISTE DES ARTICLES pormo du moment
	// require_once ("../services/ResponsableService.php");
	
	// $responsableService = new ResponsableService ();
	
	// $_SESSION ['listArticlePromo'] = $responsableService->getListPromoDuMoment();
	
	// $listArticle = $_SESSION ['listArticlePromo'];
	
	// foreach ( $listArticle as $promotion) {
	// echo '<div class="col-lg-2 col-md-2 col-xs-4 column productbox"';
	// echo ' style="background-color: #F1F1F1;">';
	// echo ' <a class="thumbnail" href="#"> <img class="img-responsive"';
	// echo ' src="../img/'.$promotion->getNumArticle ().'.jpg" onclick="actionImageClick()"></a>';
	// echo ' <div class="producttitle">'.$promotion->getLibelle ().'</div>';
	// echo ' <div class="productprice">';
	// echo ' <div class="pricetext">';
	// echo ' <strike style="color: #B40404;">'.$promotion->getPrixUnitaire ().'€</strike>';
	// echo ' </div>';
	// echo ' </div>';
	// echo ' <div class="productprice">';
	// echo ' <div class="pull-right">';
	// echo ' <a href="#" class="btn btn-info btn-sm" role="button">Sélectionner</a>';
	// echo ' </div>';
	// $res = $promotion->getPrixUnitaire () - $promotion->getPrixUnitaire ()*$promotion->getPourcentagePromo()/100;
	// echo ' <div class="pricetext" style="color: #088A4B">'.number_format($res,2).'€</div>';
	// echo ' </div>';
	// echo ' </div>';
	// }
	//	?>

	<?php
	// // AFFICHE L'article sur lequel on a cliqué
	// require_once ("../services/ResponsableService.php");
	
	// $responsableService = new ResponsableService ();
	
	// $_SESSION ['article'] = $responsableService->getArticle (3);
	
	// $Article = $_SESSION ['article'];
	
	// echo '<div class="col-lg-2 col-md-2 col-xs-4 column productbox"';
	// echo ' style="background-color: #F1F1F1;">';
	// echo ' <a class="thumbnail" href="#"> <img class="img-responsive"';
	// echo ' src="../img/'.$Article->getNumArticle ().'.jpg" onclick="actionImageClick()"></a>';
	// echo ' <div class="producttitle">'.$Article->getLibelle ().'</div>';
	// echo ' <div class="productprice">';
	// echo ' <div class="pricetext">';
	// echo ' <strike style="color: #B40404;">'.$Article->getPrixUnitaire ().'€</strike>';
	// echo ' </div>';
	// echo ' </div>';
	// echo ' <div class="productprice">';
	// echo ' <div class="pull-right">';
	// echo ' <a href="#" class="btn btn-info btn-sm" role="button">Sélectionner</a>';
	// echo ' </div>';
	// $res = $Article->getPrixUnitaire () - $Article->getPrixUnitaire ()*15/100;
	// echo ' <div class="pricetext" style="color: #088A4B">'.number_format($res,2).'€</div>';
	// echo ' </div>';
	// echo ' </div>';
	//	?>

	
	<?php
	// AFFICHE LA LISTE DES ARTICLES CORRESPONDANT A UNE CATEG
	require_once ("../services/ResponsableService.php");
	
	$responsableService = new ResponsableService ();
	
	$_SESSION ['listPromotion'] = $responsableService->getListPromo ( "cuisine" );
	
	$listPromo = $_SESSION ['listPromotion'];
	
	foreach ( $listPromo as $promotion ) {
		$article = $responsableService->getArticle ( $promotion->getNumArticle () );
		echo '<div class="col-lg-2 col-md-2 col-xs-4 column productbox"';
		echo '			style="background-color: #F1F1F1;">';
		echo '			<a class="thumbnail" href="#"> <img class="img-responsive"';
		echo '				src="../img/' . $promotion->getNumArticle () . '.jpg" onclick="actionImageClick()"></a>';
		echo '			<div class="producttitle">' . $article->getLibelle () . '</div>';
		echo '			<div class="productprice">';
		echo '				<div class="pricetext">';
		echo '					<strike style="color: #B40404;">' . $article->getPrixUnitaire () . '€</strike>';
		echo '				</div>';
		echo '			</div>';
		echo '			<div class="productprice">';
		echo '				<div class="pull-right">';
		echo '					<a class="btn btn-info btn-sm" href="../action/retirerPromoDuMomentAction.php?numArticle=' . $article->getNumArticle () . '">Retirer</a>';
		echo '				</div>';
		$res = $article->getPrixUnitaire () - $article->getPrixUnitaire () * $promotion->getPourcentagePromo () / 100;
		echo '				<div class="pricetext" style="color: #088A4B">' . number_format ( $res, 2 ) . '€</div>';
		echo '			</div>';
		echo '		</div>';
	}
	?>
	
	
	
	
	</div>


</body>
<footer>
	<script src="http://code.jquery.com/jquery.js"></script>
	<script src="../js/bootstrap.js"></script>
	<script type="text/javascript">
		function actionImageClick() {
			alert("Promotion ajoutée");
		}
	</script>
</footer>
</html>